﻿using System;

using E.BLL;
using E.Web.UI.Page;

using X.Common;

namespace E.Web.Teacher.internals.surveysetting
{
    public partial class D : TeacherBasePage
    {
        protected override void ShowPage()
        {
            string act = XRequest.GetString("act");
            string t = XRequest.GetString("t");
            if (ispost && act == "d")
            {
                string request_id = XRequest.GetString("arrv");
                if (request_id != "")
                {
                    string[] idarr;
                    if (request_id.IndexOf(',') != -1)
                    {
                        idarr = request_id.Split(',');
                    }
                    else
                        idarr = new string[] { request_id };

                    SurveyBLL bll = new SurveyBLL();

                    int rst = -1;
                    string pageName = "";

                    switch (t)
                    { 
                        case "1":
                            //course
                            rst = bll.DelCourseSurvey(idarr);
                            pageName = "CourseList";
                            break;
                        case "2":
                            //certificate
                            rst = bll.DelCertificateSurvey(idarr);
                            pageName = "CertificateList";
                            break;
                        default:
                            break;
                    }

                    string msg = "";

                    if (rst > 0)
                    {
                        msg = "删除成功";
                    }
                    else
                    {
                        msg = "删除失败";
                    }

                    ExecuteJS("alert('" + msg + "'); window.location = '/internals/surveysetting/" + pageName + ".aspx';");
                    return;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
